# Contributor: Duncan Bellamy <dunk@denkimushi.com>
# Maintainer: Duncan Bellamy <dunk@denkimushi.com>
pkgname=py3-dns-lexicon
pkgver=3.18.0
pkgrel=0
pkgdesc="Manipulate DNS records on various DNS providers in a standardized/agnostic way"
url="https://github.com/AnalogJ/lexicon"
arch="noarch"
license="MIT"
#tests need net access
options="net"
depends="
	py3-beautifulsoup4
	py3-cryptography
	py3-dnspython
	py3-otp
	py3-requests
	py3-tldextract
	py3-yaml
	"
makedepends="py3-gpep517 py3-poetry-core"
_providerdepends="
	py3-boto3
	py3-localzone
	py3-oci
	py3-softlayer
	py3-softlayer-zeep
	py3-xmltodict
	"
checkdepends="
	py3-pytest
	py3-pytest-xdist
	py3-vcrpy
	$_providerdepends
	"
subpackages="$pkgname-pyc"
source="$pkgname-github-$pkgver.tar.gz::https://github.com/AnalogJ/lexicon/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/lexicon-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	# auto and namecheap tests fail in rootbld
	# godaddy has vcrpy overwrite existing cassete errors
	.testenv/bin/python3 -m pytest \
		--ignore tests/providers/test_localzone.py \
		--ignore tests/providers/test_auto.py \
		--ignore tests/providers/test_godaddy.py \
		--ignore tests/providers/test_namecheap.py
}

package() {
	python3 -m installer -d "$pkgdir" .dist/*.whl
	rm -rf "$pkgdir"/usr/lib/python3*/site-packages/lexicon/tests
}

sha512sums="
da2804caeef6cd96eb53f7414833757905afa269f328271fccbdb06d988fb46695a0cb917b8dbdfb66579b01cc98d07de8eb7e1cb132c47d49fe05e2ebe18127  py3-dns-lexicon-github-3.18.0.tar.gz
"
